//
//  DDNavigationController.swift
//  doudou_weibo
//
//  Created by apple on 2016/11/12.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class DDNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        if self.childViewControllers.count > 0 {
            
            let leftButton = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(clickLeftButton))
            
            viewController.navigationItem.leftBarButtonItem = leftButton
            
            viewController.hidesBottomBarWhenPushed = true
            
        }
        
        super.pushViewController(viewController, animated: animated)
        
    }
    
    
    func clickLeftButton() {
        
        self.popViewController(animated: true)
    }
    
    
    
    
    


}
